with open("Walden.txt", encoding="utf-8") as f:
    f1 = str(f.read())
    f1 = f1.replace(",", "")\
        .replace(".", "")\
        .replace("-", "")\
        .replace("+", "")\
        .replace("$", "")\
        .replace("/", "")\
        .replace(";", "")\
        .replace(":", "")\
        .replace('"', '')\
        .replace("'", "")\
        .replace("?", "")\
        .replace("!", "")\
        .replace('0', "")\
        .replace('1', "")\
        .replace('2', "")\
        .replace('3', "")\
        .replace('4', "")\
        .replace('5', "")\
        .replace('6', "")\
        .replace('7', "")\
        .replace('8', "")\
        .replace('9', "")\
        .replace('(', "")\
        .replace(')', "")
    f2 = f1.split()
    f3 = set(f2)
    for k in f3:
        f4 = f2.count(k)
        print(f"{k}出现了{f4}次")
